# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=gspell
pkgver=1.12.1
pkgrel=1
pkgdesc="Spell-checking library for GTK applications"
url="https://gitlab.gnome.org/GNOME/gspell"
arch=(x86_64)
license=(LGPL)
depends=(
  enchant
  glib2
  gtk3
  icu
)
makedepends=(
  autoconf-archive
  git
  gobject-introspection
  gtk-doc
  vala
)
_commit=d04dec63809b009c1ab12b2f80ceeeeab4709a48  # tags/1.12.1^0
source=("git+https://gitlab.gnome.org/GNOME/gspell.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd gspell
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd gspell
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  local configure_options=(
    --prefix=/usr
    --sysconfdir=/etc
    --localstatedir=/var
    --enable-gtk-doc
  )

  cd gspell
  ./configure "${configure_options[@]}"
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package(){
  depends+=(
    libenchant-2.so
    libgtk-3.so
    libg{lib,object,io}-2.0.so
    libicuuc.so
    libpango-1.0.so
  )
  provides+=("libgspell-${pkgver%%.*}.so")

  cd gspell
  make DESTDIR="$pkgdir" install
}

# vim:set sw=2 sts=-1 et:
